<?php

/**
 * Description of BuscaAjaxTabulada
 *
 * @author Raphael
 */
class BuscaAjaxTabulada {
   
    protected $tableSql;
    protected $rpc;
    /**
     *
     * @param <string> $rpc Arquivo RPC
     * @param <type> $sql
     * @param <type> $conexao
     * @param <type> $extra
     */
    public function __construct($rpc, $id, $nome, $extra = null){
        $html = new CampoBusca($id, $nome);
        
        $script =
            "
            <script type='text/javascript'>
                $('document').ready(function(){
                    $('#pesquisa_ico_lupa').click(function(){
                        $.post('{$rpc}',{busca: $('#{$id}').val()},
                        function(data){
                            var tbl = data;
                            $('#tabelaAjaxRpc').html(tbl);
                        });
                    });
                });
            </script>
            ";

        $conteudo =
            "
                <div id='tabelaAjaxRpc'>
                </div>
            ";
        echo "$script \n $conteudo";
    }
}

/*
 include_once('../config.php');
 echo "<script type='text/javascript' src='../lib/jquery.js'></script>";
 $a = new BuscaAjaxTabulada('../app/rpc/teste.php', 'buscaUsuario', 'buscaLogin');
*/

?>
